package me.helllp.dake.generator.meta;

import com.squareup.javapoet.AnnotationSpec;
import freemarker.template.TemplateException;
import me.helllp.dake.generator.config.GeneratorEngineConfiguration;
import me.helllp.dake.generator.engine.AbstractGenerator;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

/**
 * 三方组件配置接口
 */
public interface IThirdComponent {
    /**
     * 构造三方组件的spring boot配置信息
     *
     * @return
     */
    Map<String, Object> toSpringBootSettings();

    /**
     * 构造三方组件的POM依赖信息
     *
     * @return
     */
    List<PomMetaData> toDependency();

    /**
     * 获取代码构造器
     *
     * @param engineConfiguration 代码引擎配置
     * @param projectMetaData 项目元数据信息
     * @return
     */
    AbstractGenerator toGenerator(GeneratorEngineConfiguration engineConfiguration, ProjectMetaData projectMetaData) throws TemplateException, IOException, InvocationTargetException, IllegalAccessException;

    /**
     * 获取由于增加三方键导致的注解增加
     *
     * @param projectMetaData 项目元数据信息
     *
     * @return
     */
    List<AnnotationSpec> toAnnotations(ProjectMetaData projectMetaData);
}
